<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            //初始化加载所有的分类  以及要修改的数据

            init();
            function init() {



                $.ajax({
                    "url":"${pageContext.request.contextPath}/client/getProduct.html",
                    "type":"GET",
                    "async": false,//同步请求
                    "dataType":"json",
                    "success":function (data) {
                        $(data).each(function () {
                            $("#product_name").append("<option value='"+this.product_id+"'>"+this.product_name+"</option>")
                        })
                    }
                });




            }
        })

    </script>
</head>
<body>
<form action="${pageContext.request.contextPath}/client/add.html" id="myForm" method="post">
    <table border="1" width="500" align="center" cellspacing="0" cellpadding="0">
        <tr align="center">
            <td colspan="2">
                <h1>添加订单</h1>
            </td>
        </tr>


        <tr>
            <td>商品名称</td>
            <td>
                <select id="product_name" name="product_name">
                    <option value="0">请选择</option>
                </select>
            </td>
        </tr>


        <tr>
            <td>商品数量</td>
            <td>
                <input type="text" name="product_num" id="product_num">
            </td>
        </tr>


        <tr align="center">
            <td colspan="2">
                <input type="submit"  value="提交"/>
                <input type="reset" value="重置"/>
            </td>
        </tr>
    </table>

</form>
</body>
</html>
